package org.turnlink.sclm.service.impl;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import org.turnlink.sclm.dao.ContactDao;
import org.turnlink.sclm.model.Contact;
import org.turnlink.sclm.service.ContactManager;

@Service
public class ContactManagerImpl implements ContactManager {

    private final Log logger = LogFactory.getLog(getClass());
	
	@Autowired
	private ContactDao contactDao;

	@Override
	public void add(Contact contact) {
		this.contactDao.saveOrUpdate(contact);
	}

	public void remove(Contact contact) {
		this.contactDao.remove(contact);
	}
	
	@Override
	public void batchInsert(MultipartFile file) {
		// TODO Auto-generated method stub

	}

	@Override
	public int count(String query) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public List<Contact> find(String query) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Contact get(int contactId) {
		return contactDao.findById(contactId);
	}

	@Override
	public void update(Contact contact) {
		this.contactDao.saveOrUpdate(contact);
	}

}
